/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.fee.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.fee.entity.PaymentDetail;
import com.jeeplus.modules.fee.mapper.PaymentDetailMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 付款单明细表Service
 * @author weisong
 * @version 2017-09-20
 */
@Service
@Transactional(readOnly = true)
public class PaymentDetailService extends CrudService<PaymentDetailMapper, PaymentDetail> {

	public PaymentDetail get(String id) {
		return super.get(id);
	}
	
	public List<PaymentDetail> findList(PaymentDetail paymentDetail) {
		return super.findList(paymentDetail);
	}
	
	public Page<PaymentDetail> findPage(Page<PaymentDetail> page, PaymentDetail paymentDetail) {
		return super.findPage(page, paymentDetail);
	}
	
	@Transactional(readOnly = false)
	public void save(PaymentDetail paymentDetail) {
		super.save(paymentDetail);
	}
	
	@Transactional(readOnly = false)
	public void delete(PaymentDetail paymentDetail) {
		super.delete(paymentDetail);
	}
	// 关联付款单明细表
	public List<PaymentDetail> findPaymentDetailById(String id) {
		return mapper.findPaymentDetailById(id);
	}

	// 计算核销总金额
	public List<PaymentDetail> findVcaMoneyById(String id, String invoiceId, String invoiceDetailId) {
		return mapper.findVcaMoneyById(id, invoiceId, invoiceDetailId);
	}

	// 查看本次核销金额
	public List<PaymentDetail> findInvoiceMoneyById(@Param("id") String id, @Param("invoiceId") String invoiceId) {
		return mapper.findInvoiceMoneyById(id, invoiceId);
	}

	//根据发票子表id查付款单子表
	public List<PaymentDetail> findAllByPayInvoiceDetail(String id){
		return mapper.findAllByPayInvoiceDetail(id);
	}

	//根据发票id获取付款单子表
	public List<PaymentDetail> findPaymentDetailByInvoiceId(String invoiceId, String detailId){
		return mapper.findPaymentDetailByInvoiceId(invoiceId , detailId);
	}
}